<template>
  <div class="home-container">
    <header>
      <h1>AI聊天助手</h1>
      <button @click="goToUserCenter" class="user-center-btn">个人中心</button>
    </header>
    <main>
      <div class="card" @click="goToChat">
        <h3>开始聊天</h3>
        <p>与AI助手进行对话</p>
      </div>
      <div class="card" @click="goToChatHistory">
        <h3>聊天历史</h3>
        <p>查看之前的对话记录</p>
      </div>
    </main>
    <footer>
      <p>© 2023 AI聊天助手</p>
    </footer>
  </div>
</template>

<script>
import { useRouter } from 'vue-router'

export default {
  name: 'MainHome',
  setup() {
    const router = useRouter()

    const goToChat = () => {
      router.push('/chat')
    }

    const goToChatHistory = () => {
      router.push('/chat-history')
    }

    const goToUserCenter = () => {
      router.push('/user-center')
    }

    return {
      goToChat,
      goToChatHistory,
      goToUserCenter
    }
  }
}
</script>

<style scoped>
.home-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background-color: #42b983;
  color: white;
}

.user-center-btn {
  padding: 8px 16px;
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.card {
  width: 200px;
  height: 150px;
  margin: 0 20px;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.3s;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.card:hover {
  transform: translateY(-5px);
}

.card h3 {
  margin-bottom: 10px;
  color: #333;
}

.card p {
  color: #666;
  text-align: center;
}

footer {
  padding: 10px;
  background-color: #f5f5f5;
  text-align: center;
  color: #666;
}
</style>